<?php
/**
 * 展会资讯
 * User: jh
 * Date: 2018/3/23
 * Time: 18:23
 */
namespace frontend\widgets;
use common\models\News;
use yii\bootstrap\Widget;

class Exhibitionnews extends Widget {

    private $view = '@frontend/views/widget/exhibitionnews.php';

    public $params = [];

    public function init()
    {

        $zhzx = News::find()->select('id,title,desc,views,created_at')->where(['category_id'=>1,'status'=>1,'is_deleted'=>0])
            ->orderBy('id desc')
            ->limit(6)
            ->asArray()
            ->all();
        $this->params['zhzx'] = $zhzx;
    }

    public function run()
    {
        echo $this->renderFile($this->view, $this->params);
    }
}